package com.yt.fras.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yt.fras.mapper.AttendanceMapper;
import com.yt.fras.pojo.entity.Attendance;
import com.yt.fras.pojo.model.AttendanceInfo;
import com.yt.fras.service.AttendanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 考勤表 服务实现类
 * </p>
 *
 * @author yt
 * @since 2021-10-25
 */
@Service
@CacheConfig(cacheNames = "attendanceCache")
public class AttendanceServiceImpl extends ServiceImpl<AttendanceMapper, Attendance> implements AttendanceService {

    @Autowired
    private AttendanceMapper attendanceMapper;

    @Override
    public List<AttendanceInfo> getAttendancesByGroup(String groupId) {
        return attendanceMapper.getAttendancesByGroup(groupId);
    }

    @Override
    public List<AttendanceInfo> getEnableAttendancesByGroup(String groupId, String userId) {
        Map<String, Object> map = new HashMap<>();
        map.put("groupId", groupId);
        map.put("userId", userId);
        return attendanceMapper.getEnableAttendancesByGroup(map);
    }

}
